Add dataUri and dataUriToString functions#1332
Merged
SteveL-MSFT merged 21 commits intoPowerShell:mainfrom Jan 20, 2026
Merged
Conversation
SteveL-MSFT
requested changes
Jan 7, 2026
SteveL-MSFT
requested changes
Jan 12, 2026
bf06fc1 to
aa04b78
Compare
SteveL-MSFT
requested changes
Jan 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds two new DSC configuration functions: dataUri() and dataUriToString(). The dataUri() function converts a string to a base64-encoded data URI format, while dataUriToString() performs the inverse operation by decoding a data URI back to its original string.
Changes:
- Added
dataUri()function to convert strings to data URI format with base64 encoding - Added
dataUriToString()function to decode base64-encoded data URIs back to strings - Included comprehensive unit tests and integration tests for both functions
- Added documentation with examples for both functions
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/dsc-lib/src/functions/mod.rs | Registered the new data_uri and data_uri_to_string modules in alphabetical order |
| lib/dsc-lib/src/functions/data_uri.rs | Implemented dataUri() function that encodes strings as base64 data URIs with application/json media type |
| lib/dsc-lib/src/functions/data_uri_to_string.rs | Implemented dataUriToString() function that decodes base64-encoded data URIs to strings with UTF-8 validation |
| lib/dsc-lib/locales/en-us.toml | Added localization strings for function descriptions and error messages |
| dsc/tests/dsc_functions.tests.ps1 | Added comprehensive PowerShell integration tests covering normal operation, error cases, and edge cases |
| docs/reference/schemas/config/functions/overview.md | Added references to the new functions in the string functions section |
| docs/reference/schemas/config/functions/dataUri.md | Added documentation for dataUri() function with examples and parameter descriptions |
| docs/reference/schemas/config/functions/dataUriToString.md | Added documentation for dataUriToString() function with examples and exception details |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SteveL-MSFT
requested changes
Jan 15, 2026
| if *part == "base64" { | ||
| has_base64 = true; | ||
| } else if part.starts_with("charset=") { | ||
| charset_count += 1; |
Member
There was a problem hiding this comment.
Instead of having charset_count, you should just check if charset.is_some() (after renaming charset_value to just charset since it'd be the only variable)
SteveL-MSFT
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This pull request adds the
dataUrianddataUriToStringfunctions, including tests and documentation.PR Context
Partially addresses #57.